//
//  SendTableViewCell.m
//  OfferJob
//
//  Created by 河南动力无限科技有限公司 on 17/7/10.
//  Copyright © 2017年 郑州动力无限科技. All rights reserved.
//

#import "SendTableViewCell.h"

@implementation SendTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
  
        _imagView=[[UIImageView alloc]initWithFrame:CGRectMake(10*kAppScale, 10*kAppScale, 60*kAppScale, 60*kAppScale)];
        _imagView.backgroundColor=[UIColor redColor];
        _imagView.image=[UIImage imageNamed:@""];
        [self.contentView addSubview:_imagView];

        
        _titleLB=[[UILabel alloc]initWithFrame:CGRectMake(80*kAppScale, 10*kAppScale,150*kAppScale, 20*kAppScale)];
        _titleLB.textColor=[UIColor blackColor];
        _titleLB.textAlignment=NSTextAlignmentLeft;
        _titleLB.font=[UIFont systemFontOfSize:13*kAppScale];
        [self.contentView addSubview:_titleLB];

        _nameLB = [UILabel new];
        _nameLB.font = [UIFont systemFontOfSize:12*kAppScale];
//        _nameLB.text = @"文字在语言学语言学";
        _nameLB.textColor = grayTextColor;
        CGSize lblSize = [_nameLB.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 30*kAppScale) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]} context:nil].size;
        _nameLB.frame = CGRectMake(80*kAppScale, 30*kAppScale, lblSize.width, lblSize.height);
        [self.contentView addSubview:_nameLB];
        

       _iconImage=[[UIImageView alloc]initWithFrame:CGRectMake(_nameLB.right+5*kAppScale, 30*kAppScale,15*kAppScale,15*kAppScale)];
      _iconImage.image=[UIImage imageNamed:@"icon_bao"];
        [self.contentView addSubview:_iconImage];
        
        
        _numLB=[[UILabel alloc]initWithFrame:CGRectMake(80*kAppScale,50*kAppScale,100*kAppScale, 20*kAppScale)];
        _numLB.textColor=grayTextColor;
        _numLB.textAlignment=NSTextAlignmentLeft;
        _numLB.font=[UIFont systemFontOfSize:11*kAppScale];
        [self.contentView addSubview:_numLB];
        
        
        
        _dayLB=[[UILabel alloc]initWithFrame:CGRectMake(180*kAppScale,50*kAppScale,30*kAppScale, 20*kAppScale)];
        _dayLB.textColor=grayTextColor;
        _dayLB.textAlignment=NSTextAlignmentLeft;
        _dayLB.font=[UIFont systemFontOfSize:11*kAppScale];
        [self.contentView addSubview:_dayLB];
        
        
        _moneyLB=[[UILabel alloc]initWithFrame:CGRectMake(260*kAppScale,10*kAppScale,100*kAppScale, 20*kAppScale)];
        _moneyLB.textColor=grayTextColor;
        _moneyLB.textAlignment=NSTextAlignmentRight;
        _moneyLB.font=[UIFont systemFontOfSize:12*kAppScale];
        [self.contentView addSubview:_moneyLB];
        
        
        
        _timeLB=[[UILabel alloc]initWithFrame:CGRectMake(260*kAppScale,35*kAppScale,100*kAppScale, 20*kAppScale)];
        _timeLB.textColor=grayTextColor;
        _timeLB.textAlignment=NSTextAlignmentRight;
        _timeLB.font=[UIFont systemFontOfSize:12*kAppScale];
        [self.contentView addSubview:_timeLB];
        
        
        
        _LineView=[[UIView alloc]initWithFrame:CGRectMake(10*kAppScale, 79*kAppScale,SCREEN_WIDTH-20*kAppScale, 0.5)];
        _LineView.backgroundColor=blackLineColore;
        [self.contentView addSubview:_LineView];
        
        
        
        
        
       
        
        
    }
    return self;
}

- (CGRect)getAttributedStringHeight:(NSString*)strDes andSpaceWidth:(CGFloat)fWidth andFont:(UIFont*)font
{
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:[strDes dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
    
    [attributedString addAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                     font,
                                     NSFontAttributeName,
                                     [UIColor grayColor],
                                     NSForegroundColorAttributeName,nil]
                              range:NSMakeRange(0, attributedString.length)];
    
    UITextView *temp = [[UITextView alloc]initWithFrame:CGRectMake(100.0f, 100.0f, [UIScreen mainScreen].bounds.size.width - fWidth, 1)];
    [temp setBackgroundColor:[UIColor whiteColor]];
    temp.textColor = [UIColor grayColor];
    temp.font = font;
    [temp setEditable:NO];
    [temp setScrollEnabled:NO];
    temp.attributedText = attributedString;
    // 计算 text view 的高度
    CGRect textSize;
    textSize = temp.bounds;
    // 计算 text view 的高度
    CGSize maxSize=CGSizeMake(textSize.size.width,CGFLOAT_MAX);
    CGSize newSize1=[temp sizeThatFits:maxSize];
    textSize.size = newSize1;
    //XNLog(@"%f",temp.contentSize.height);
    return textSize;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
